import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView,
        redirect: 'index',
        children: [
            {
                path: '/index',
                component: () => import("../views/home/IndexView.vue")
            },
            {
                path: '/login',
                component: () => import("../views/home/LoginView.vue")
            },
            {
                path:'/movie',
                component:()=>import("../views/MovieDetails.vue")
            },

            {
                path:'/personal',
                component: () => import("../views/home/PersonalView.vue"),
                redirect:'/personal/uindex',
                children:[
                    {
                        path:'uindex',
                        component: () => import("../views/home/personal/PersonalIndexView.vue")
                    },{
                        path:'management',
                        component: () => import("../views/home/personal/PersonalManagementView.vue")
                    }
                ]
            },

            {
                path: '/classify',
                component: () => import("../views/home/ClassifyView.vue"),
                redirect: '/popular',
                children: [
                    {
                        path: '/popular',
                        component: () => import("../views/home/classify/PopularSortsView.vue")
                    },
                    {
                        path: '/time',
                        component: () => import("../views/home/classify/TimeOrderingView.vue")
                    },
                    {
                        path: '/review',
                        component: () => import("../views/home/classify/ReviewSortingView.vue")
                    },
                ]
            },
            {
                path: '/cinemas',
                component: () => import("../views/home/CinemasView.vue")
            },
            {
                path: '/best',
                component: () => import('../views/comment/BestComment.vue'),
            },
            {
                path: '/latest',
                component: () => import('../views/comment/LatestComment.vue'),
            },
            {
                path: '/DetailComment',
                component: () => import('../views/comment/DetailCommentView.vue')
            },
            {
                path: '/new_view',
                component: ()=> import('../views/newView.vue'),
            },
            {
                path: '/cinema',
                component: ()=>import('../views/CinemaView.vue')
            },
            {
                path: '/seat',
                component: () => import('../views/SeatsView.vue'),
            },
        ]
    },
    {
        path: '/admin',
        component: () => import( '../views/AdminView.vue'),
        children: [{
            path: 'banner',
            component: () => import('../views/admin/BannerView.vue'),
        }]
    }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
